package worker

import (
	"imooc.com/crawler/engine"
)


type CrawlService struct{}

func (CrawlService) Process(req Request,
	result *ParseResult) error  {
	engineReq, err := DeserializeRequest(req)
	if err != nil {
		return err
	}

	enginResult, err := engine.Worker(engineReq)
	if err != nil {
		return err
	}

	*result = SerializeResult(enginResult)
	return nil
}